home *** CD-ROM | disk | FTP | other *** search
- Path: victor2.vv.cta.com!usenet
- From: Daron Baird <daron@rc.cta.com>
- Newsgroups: comp.unix.programmer,comp.unix.questions,comp.unix.misc,comp.lang.c,comp.sys.hp.hpux
- Subject: How to determine type of connection from file descriptor
- Date: 27 Mar 1996 22:18:15 GMT
- Organization: cta
- Message-ID: <4jcer7$ck@victor2.vv.cta.com>
- NNTP-Posting-Host: pc13.rc.cta.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
-
- I need to write a routine that can determine what type of connection a
- file descriptor represents, tcp, udp, or serial. I am running HPUX 9.07
- on a HP9000. The language is C.
-
- The pseudo code would look like the following:
-
- routine1(fd)
- int fd;
-
- {
- if fd is connected to a serial port then
- call serial_port_function
- else if fd is connected to a TCP port then
- call tcp_function
- else if fd is connected to a UDP port then
- call udp_function
- endif
-
- }
-
- The question that I have is: how does one determine from the file
- descriptor what type of connection it represents. Is there an ioctl like
- call that can determine this information?
-
-
-